<%-- 
    Document   : viewOther
    Created on : 2016-4-5, 10:01:42
    Author     : Administrator
--%>

<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <script  type="text/javascript" src="${base}/js/jquery-1.9.1.js"></script>
        <script  type="text/javascript" src="${base}/js/angular/angular.min.js"></script>
        <script  type="text/javascript" src="${base}/js/jquery.cxhd.js"></script>
        <script  type="text/javascript" src="${base}/js/bootstrap.min.js"></script>
        <script  type="text/javascript" src="${base}/js/upload.js"></script>
        <link href='${base}/css/bootstrap-paper.css'  rel='stylesheet' type='text/css' />
        <link href='${base}/css/font-awesome.css'  rel='stylesheet' type='text/css' />
        <title>JSP Page</title>
    </head>
    <body ng-app="app_view" ng-controller="ctrlMain" >
        <div class="container">
        <div class="col-lg-12" >
            <div class="col-lg-12" ng-repeat="data in datas">
                <div class="panel panel-default">
                    <div class="panel-heading">{{data.event_name}}</div> 
                    <div class="panel-body" >
                        <table class="table">
                            <tr ng-repeat="re in data.data">
                                <td>{{re}}</td>
                            </tr>
                        </table>
                    </div>
                </div>

            </div>
        </div>
        </div>
        <div stype="display:none" id="ty" ng-click="getData()"></div>
    </body>
</html>
<script>
    var allData = [];
    function getParentData(item) {

        console.log(item);

        var im = {pk: item.pk, event_name: item.event_name, type: item.result_type};
        if (item.result_type == "image") {
            im.data = "getImage?fileId=" + item.event_result;

            allData.push(im);
            $("#ty").click();

        } else if (item.result_type == 'table') {
            if (item.data_type == 'lis_detail') {
                $.post("getLisResult", {pk: item.pk}, function (data) {
                    if (data) {
                        $scope.lisResults = data;
                        im.data = data;
                        allData.push(im);
                        $("#ty").click();
                    }
                })
            }

        } else {
            $.post("getResult", {pk: item.pk, type: item.result_type}, function (data) {

                if (data) {
                    if (item.result_type == 'html') {


                        im.data = unescape(data);

                    } else {

                        im.data = data.split("@");
                        //console.log($scope.results);
                    }
                    allData.push(im);

                    $("#ty").click();

                }
            })
        }
    }
    function getPing() {
        return "test";
    }
    angular.module("app_view", [])
            .controller("ctrlMain", function ($scope) {
                $scope.datas = [];
                $scope.getData = function () {
                    $scope.datas = allData;
                    console.log(allData);
                }
            })
</script>
